<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        html,body{
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        #app{
            width: 100%;
            height: 100%;
            overflow: hidden;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .wrap{
            list-style: none;
            width: 300px;
            border: 1px solid;
        }
        .wrap li{
            display: flex;
        }
        .wrap li span{flex: 1}
        .wrap li button{flex: 1}
    </style>
</head>
<body>
    <div id="app">
        <button @click="clearFn">clear</button>
        <ul class="wrap">
            <li v-for="(item,index) in list">
                <span>{{item.name}}</span>
                <span>{{item.age}}</span>
                <span>{{item.wife}}</span>
                <button @click="delFn(index)">del</button>
                <button @click="updateFn(index)">update</button>
            </li>
        </ul>
    </div>
</body>
<script src="../../js/vue.js"></script>
<script>
    new Vue({
        el:"#app",
        data:{
            list:[
                {name:"达姆",wife:"冬雨",age:18},
                {name:"高小乐",wife:"低大悲",age:38},
                {name:"老付",wife:"培悦",age:48},
                {name:"xxx",wife:"朦朦",age:58}
            ]
        },
        methods:{
            delFn(index){
                this.list.splice(index,1)
            },
            updateFn(index){
                // this.list[index] = {name:"abc",age:8,wife:"cba"}
                this.list.splice(index,1,{name:"abc",age:8,wife:"cba"})
            },
            clearFn(){
                // this.list.length=0;
                this.list.splice(0)
            }
        }
    })
</script>
</html>